package org.jeecgframework.web.material.controller;

import net.sf.json.JSONObject;

import org.jeecgframework.web.material.entity.OrderInfoEntity;
import org.jeecgframework.web.material.entity.OrderInstallEntity;
import org.jeecgframework.web.material.entity.OrderMeasureEntity;
<<<<<<< HEAD
=======
import org.jeecgframework.web.material.entity.OrderProcessEntity;
>>>>>>> a9c7731b4788b28c37d962faa7843e2cac438e61
import org.jeecgframework.web.material.entity.PartTemplateEntity;
import org.jeecgframework.web.material.service.OrderInfoServiceI;
import org.jeecgframework.web.material.page.OrderInfoPage;
import org.jeecgframework.web.material.entity.OrderProductEntity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.annotation.Scope;
<<<<<<< HEAD
=======
import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
>>>>>>> a9c7731b4788b28c37d962faa7843e2cac438e61
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;

/**
 * @Title: Controller
 * @Description: 用户基本信息
 * @author onlineGenerator
 * @date 2015-08-30 11:59:58
 * @version V1.0
 * 
 */
@Scope("prototype")
@Controller
@RequestMapping("/orderInfoController")
public class OrderInfoController extends BaseController {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger
			.getLogger(OrderInfoController.class);

	@Autowired
	private OrderInfoServiceI orderInfoService;
	@Autowired
	private SystemService systemService;
	@Autowired
	private CommonService commonService;
	

	/**
	 * 用户基本信息列表 页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "orderInfo")
	public ModelAndView orderInfo(HttpServletRequest request) {
		return new ModelAndView("material/orderInfo/orderInfoList");
	}

	/**
	 * 尺寸测量列表 页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "orderMeasure")
	public ModelAndView orderMeasure(HttpServletRequest request) {
		return new ModelAndView("material/orderInfo/measure/orderInfoList");
	}
	
	/**
	 * 综合查询详情页面.
	 * 
	 * @return
	 */
	@RequestMapping(params = "orderQueryDetail")
	public ModelAndView orderQueryDetail(HttpServletRequest request) {
		String orderId = request.getParameter("orderId");
		request.setAttribute("orderId", orderId);
		return new ModelAndView("material/orderInfo/orderQueryDetail");
	}

	/**
	 * easyui AJAX综合详情查询
	 * 
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 */

	@RequestMapping(params = "orderQueryDetailDatagrid")
	public void orderQueryDetailDatagrid(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
        //订单ID
		String orderId =request.getParameter("orderId");
		//产品名称
        String name = request.getParameter("name")==null?"":request.getParameter("name");
		StringBuffer rows = new StringBuffer();
		//查询SQL
		String sql = "select  p.name,p.manufacturer,p.specification,p.color,o.amount,o.price,o.total_price,proc.activity_name,proc.assigned_name from  p_product p left join order_product o  on (p.id=o.product_id) left join order_process proc on(o.id=proc.order_product_id) where o.order_id like '%"+orderId+"%'  and  p.name like '%"+name+"%'";
		List<Map<String, Object>> results =  this.commonService.findForJdbc(sql, null);
		int count =0;
		for(Map<String, Object> item:results){
			//数据组装处理
			count = count+1;
			rows.append("{'name':'"+item.get("name") +"','manufacturer':'"+item.get("manufacturer")
					+"','specification':'"+item.get("specification")+"','color':'"+item.get("color")
					+"','amount':'"+item.get("amount")
					+"','price':'"+item.get("price")
					+"','total_price':'"+item.get("total_price")
					+"','activity_name':'"+item.get("activity_name")
					+"','assigned_name':'"+item.get("assigned_name")+"'},");
	    }
		String rowStr = StringUtils.substringBeforeLast(rows.toString(), ",");
		
		JSONObject jObject = JSONObject.fromObject("{'total':"+count+",'rows':["+rowStr+"]}");
		responseDatagrid(response, jObject);
	}
	
<<<<<<< HEAD
=======
	
	/**
	 *手机端数据查询.
	 * 
	 * @param request
	 * @param response
	 */
	@RequestMapping(params = "mobileOrderQuery")
	public void mobileOrderQuery(HttpServletRequest request,
			HttpServletResponse response) {
		String mobile = request.getParameter("userTelephone1")==null?"":request.getParameter("userTelephone1").toString();
		List<Map<String, Object>> data =  commonService.findForJdbc(
				"select * from order_info a where a.user_telephone_1='"+mobile+"'", null);
		StringBuffer rows= new StringBuffer();
		int count =0;
		List<String> userList= new ArrayList<String>();
		for(Map<String, Object> item:data){
			count=count+1;
			rows.append("{'id':'"+item.get("id")
					+"','orderCode':'"+item.get("order_code")
					+"','userName':'"+item.get("user_name")
					+"','userTelephone':'"+item.get("user_telephone_1")
					+"','userAddress':'"+item.get("user_address")+"'},");
				
		}
		String rowStr = StringUtils.substringBeforeLast(rows.toString(), ",");

		JSONObject jObject = JSONObject.fromObject("{'total':" + count
				+ ",'rows':[" + rowStr + "]}");
		responseDatagrid(response, jObject);
	}
	/**
	 *手机端数据查询.
	 * 
	 * @param request
	 * @param response
	 */
	@RequestMapping(params = "mobileOrderQueryHis")
	public void mobileOrderQueryHis(HttpServletRequest request,
			HttpServletResponse response) {
		String mobile = request.getParameter("userTelephone1")==null?"":request.getParameter("userTelephone1").toString();
		List<Map<String, Object>> data =  commonService.findForJdbc(
				"select * from order_info a where a.user_telephone_1='"+mobile+"'  and a.is_submit not in('0','1')", null);
		StringBuffer rows= new StringBuffer();
		int count =0;
		List<String> userList= new ArrayList<String>();
		for(Map<String, Object> item:data){
			count=count+1;
			rows.append("{'id':'"+item.get("id")
					+"','orderCode':'"+item.get("order_code")
					+"','userName':'"+item.get("user_name")
					+"','userTelephone':'"+item.get("user_telephone_1")
					+"','userAddress':'"+item.get("user_address")+"'},");
				
		}
		String rowStr = StringUtils.substringBeforeLast(rows.toString(), ",");

		JSONObject jObject = JSONObject.fromObject("{'total':" + count
				+ ",'rows':[" + rowStr + "]}");
		responseDatagrid(response, jObject);
	}
	
	/**
	 *手机端数据查询.
	 * 
	 * @param request
	 * @param response
	 */
	@RequestMapping(params = "mobileOrderDetailQuery")
	public void mobileOrderDetailQuery(HttpServletRequest request,
			HttpServletResponse response) {
		        //订单ID
				String orderId =request.getParameter("orderId");
				//产品名称
				StringBuffer rows = new StringBuffer();
				//查询SQL
				String sql = "select  p.name,p.manufacturer,p.specification,p.color,o.amount,o.price,o.total_price,proc.activity_name,proc.assigned_name from  p_product p left join order_product o  on (p.id=o.product_id) left join order_process proc on(o.id=proc.order_product_id) where o.order_id like '%"+orderId+"%' ";
				List<Map<String, Object>> results =  this.commonService.findForJdbc(sql, null);
				int count =0;
				for(Map<String, Object> item:results){
					//数据组装处理
					count = count+1;
					rows.append("{'name':'"+item.get("name") +"','manufacturer':'"+item.get("manufacturer")
							+"','specification':'"+item.get("specification")+"','color':'"+item.get("color")
							+"','amount':'"+item.get("amount")
							+"','price':'"+item.get("price")
							+"','total_price':'"+item.get("total_price")
							+"','activity_name':'"+item.get("activity_name")+"'},");
			    }
				String rowStr = StringUtils.substringBeforeLast(rows.toString(), ",");
				
				JSONObject jObject = JSONObject.fromObject("{'total':"+count+",'rows':["+rowStr+"]}");
				responseDatagrid(response, jObject);
	}
>>>>>>> a9c7731b4788b28c37d962faa7843e2cac438e61
	/**
	 * 综合查询页面.
	 * 
	 * @return
	 */
	@RequestMapping(params = "orderQuery")
	public ModelAndView orderQuery(HttpServletRequest request) {
		return new ModelAndView("material/orderInfo/orderQuery");
	}

	/**
	 * easyui AJAX综合查询
	 * 
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 */

	@RequestMapping(params = "orderQueryDatagrid")
	public void orderQueryDatagrid(OrderInfoEntity orderInfo, HttpServletRequest request,
			HttpServletResponse response, DataGrid dataGrid) {
		CriteriaQuery cq = new CriteriaQuery(OrderInfoEntity.class, dataGrid);
		
		// 查询条件组装器
		org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
				orderInfo);
		try {
			//安装人员安排判断
//			boolean isInstall = false;
//			String installStr = request.getParameter("isInstall")==null?
//					"":request.getParameter("isInstall").toString();
//			if(!"".equals(installStr)&&Boolean.parseBoolean(installStr)){
//				isInstall = true;
//			}
			String userName=request.getParameter("userName");
			String userAddress=request.getParameter("userAddress");
			String userTelephone1=request.getParameter("userTelephone1");
			String orderCode=request.getParameter("orderCode");
			// 自定义追加查询条件
			TSUser user = ResourceUtil.getSessionUserName();
			//cq.createAlias("isSubmit", "0");
//			cq.createAlias("companyId", "companyId");
			
			//cq.eq("isSubmit",isInstall?"1":"0");
			cq.eq("orderCode", orderCode);
			cq.eq("userName", userName);
			cq.eq("userAddress", userAddress);
			cq.eq("userTelephone1", userTelephone1);
			cq.eq("companyId", user.getCompany().getId());
		} catch (Exception e) {
			throw new BusinessException(e.getMessage());
		}
		cq.add();
		this.orderInfoService.getDataGridReturn(cq, true);
		TagUtil.datagrid(response, dataGrid);
	}
	
	/**
	 * 安装列表 页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "orderInstall")
	public ModelAndView orderInstall(HttpServletRequest request) {
		return new ModelAndView("material/orderInfo/install/orderInfoList");
	}

	/**
	 * easyui AJAX请求数据
	 * 
	 * @param request
	 * @param response
	 * @param dataGrid
	 * @param user
	 */

	@RequestMapping(params = "datagrid")
	public void datagrid(OrderInfoEntity orderInfo, HttpServletRequest request,
			HttpServletResponse response, DataGrid dataGrid) {
		CriteriaQuery cq = new CriteriaQuery(OrderInfoEntity.class, dataGrid);
		
		// 查询条件组装器
		org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq,
				orderInfo);
		try {
			//安装人员安排判断
			boolean isInstall = false;
			String installStr = request.getParameter("isInstall")==null?
					"":request.getParameter("isInstall").toString();
			if(!"".equals(installStr)&&Boolean.parseBoolean(installStr)){
				isInstall = true;
			}
			// 自定义追加查询条件
			TSUser user = ResourceUtil.getSessionUserName();
			//cq.createAlias("isSubmit", "0");
			//cq.createAlias("companyId", "companyId");
			
			cq.eq("isSubmit",isInstall?"1":"0");
			//cq.eq("companyId.id", user.getCompany().getId());
		} catch (Exception e) {
			throw new BusinessException(e.getMessage());
		}
		cq.add();
		this.orderInfoService.getDataGridReturn(cq, true);
		TagUtil.datagrid(response, dataGrid);
	}

	
	/**
	 * 删除用户基本信息
	 * 
	 * @return
	 */
	@RequestMapping(params = "doDel")
	@ResponseBody
	public AjaxJson doDel(OrderInfoEntity orderInfo, HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		orderInfo = systemService.getEntity(OrderInfoEntity.class,
				orderInfo.getId());
		String message = "用户基本信息删除成功";
		try {
			orderInfoService.delMain(orderInfo);
			systemService.addLog(message, Globals.Log_Type_DEL,
					Globals.Log_Leavel_INFO);
		} catch (Exception e) {
			e.printStackTrace();
			message = "用户基本信息删除失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}
	
	/**
	 * 提交订单信息.
	 * 
	 * @return
	 */
	@RequestMapping(params = "isSubmit")
	@ResponseBody
	public AjaxJson isSubmit(OrderInfoEntity orderInfo, HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		orderInfo = systemService.getEntity(OrderInfoEntity.class,
				orderInfo.getId());
		String message = "提交成功！";
		boolean isExist = orderInfoService.isExist(orderInfo);
		try {
			if(isExist){
				orderInfoService.isSubmit(orderInfo);
			}else{
				message = "请先安排测量人员再提交！";
			}
			systemService.addLog(message, Globals.Log_Type_DEL,
					Globals.Log_Leavel_INFO);
		} catch (Exception e) {
			e.printStackTrace();
			message = "提交失败！";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}

	/**
	 * 批量删除用户基本信息
	 * 
	 * @return
	 */
	@RequestMapping(params = "doBatchDel")
	@ResponseBody
	public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		String message = "用户基本信息删除成功";
		try {
			for (String id : ids.split(",")) {
				OrderInfoEntity orderInfo = systemService.getEntity(
						OrderInfoEntity.class, Integer.parseInt(id));
				orderInfoService.delMain(orderInfo);
				systemService.addLog(message, Globals.Log_Type_DEL,
						Globals.Log_Leavel_INFO);
			}
		} catch (Exception e) {
			e.printStackTrace();
			message = "用户基本信息删除失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}

	/**
	 * 添加用户基本信息
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "doAdd")
	@ResponseBody
	public AjaxJson doAdd(OrderInfoEntity orderInfo,
			OrderInfoPage orderInfoPage, HttpServletRequest request) {
		List<OrderProductEntity> orderProductList = orderInfoPage
				.getOrderProductList();
		AjaxJson j = new AjaxJson();
		String message = "添加成功";
		try {
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
			SimpleDateFormat dfCode = new SimpleDateFormat("yyyyMMdd-HHmmss");
			//设置初始化信息
			TSUser user = ResourceUtil.getSessionUserName();
			//订单编码
			 int random=(int)(Math.random()*900)+100;
			orderInfo.setOrderCode("NO-"+dfCode.format(new Date())+"-"+String.valueOf(random));
			orderInfo.setCreateManId(user.getId());
			orderInfo.setCreateManName(user.getUserName());
			orderInfo.setCreateTime(df.format(new Date()));
			orderInfo.setCompanyId(user.getCompany().getId());
			orderInfoService.addMain(orderInfo, orderProductList);
			systemService.addLog(message, Globals.Log_Type_INSERT,
					Globals.Log_Leavel_INFO);
		} catch (Exception e) {
			e.printStackTrace();
			message = "用户基本信息添加失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}

	/**
	 * 更新用户基本信息
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "doUpdate")
	@ResponseBody
	public AjaxJson doUpdate(OrderInfoEntity orderInfo,
			OrderInfoPage orderInfoPage, HttpServletRequest request) {
		List<OrderProductEntity> orderProductList = orderInfoPage
				.getOrderProductList();
		AjaxJson j = new AjaxJson();
		String message = "更新成功";
		try {
			orderInfoService.updateMain(orderInfo, orderProductList);
			systemService.addLog(message, Globals.Log_Type_UPDATE,
					Globals.Log_Leavel_INFO);
		} catch (Exception e) {
			e.printStackTrace();
			message = "更新用户基本信息失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}

	/**
	 * 更新订单测量安排
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "doUpdateMeasure")
	@ResponseBody
	public AjaxJson doUpdateMeasure(OrderInfoEntity orderInfo,
			OrderInfoPage orderInfoPage, HttpServletRequest request) {
		List<OrderMeasureEntity> orderMeasureList = orderInfoPage
				.getOrderMeasureList();
		AjaxJson j = new AjaxJson();
		String message = "更新成功";
		try {
			orderInfoService.updateMeasure(orderInfo, orderMeasureList);
			systemService.addLog(message, Globals.Log_Type_UPDATE,
					Globals.Log_Leavel_INFO);
		} catch (Exception e) {
			e.printStackTrace();
			message = "更新订单测量安排失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}
	
	/**
	 * 更新订单安装人员安排
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "doUpdateInstall")
	@ResponseBody
	public AjaxJson doUpdateInstall(OrderInfoEntity orderInfo,
			OrderInfoPage orderInfoPage, HttpServletRequest request) {
		List<OrderInstallEntity> orderMeasureList = orderInfoPage
				.getOrderInstallList();
		AjaxJson j = new AjaxJson();
		String message = "更新成功";
		try {
			orderInfoService.updateInstall(orderInfo, orderMeasureList);
			systemService.addLog(message, Globals.Log_Type_UPDATE,
					Globals.Log_Leavel_INFO);
		} catch (Exception e) {
			e.printStackTrace();
			message = "更新订单测量安排失败";
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}

	/**
	 * 用户基本信息新增页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "goAdd")
	public ModelAndView goAdd(OrderInfoEntity orderInfo, HttpServletRequest req) {
		if (StringUtil.isNotEmpty(orderInfo.getId())) {
			orderInfo = orderInfoService.getEntity(OrderInfoEntity.class,
					orderInfo.getId());
			req.setAttribute("orderInfoPage", orderInfo);
		}
		return new ModelAndView("material/orderInfo/orderInfo-add");
	}

	/**
	 * 用户基本信息编辑页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "goUpdate")
	public ModelAndView goUpdate(OrderInfoEntity orderInfo,
			HttpServletRequest req) {
		if (StringUtil.isNotEmpty(orderInfo.getId())) {
			orderInfo = orderInfoService.getEntity(OrderInfoEntity.class,
					orderInfo.getId());
			req.setAttribute("orderInfoPage", orderInfo);
		}
		return new ModelAndView("material/orderInfo/orderInfo-update");
	}

	/**
	 * 订单测量安排编辑页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "goUpdateMeasure")
	public ModelAndView goUpdateMeasure(OrderInfoEntity orderInfo,
			HttpServletRequest req) {
		if (StringUtil.isNotEmpty(orderInfo.getId())) {
			orderInfo = orderInfoService.getEntity(OrderInfoEntity.class,
					orderInfo.getId());
			req.setAttribute("orderInfoPage", orderInfo);
		}
		return new ModelAndView("material/orderInfo/measure/orderInfo-update");
	}

	
	/**
	 * 订单测量安排编辑页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "goUpdateInstall")
	public ModelAndView goUpdateInstall(OrderInfoEntity orderInfo,
			HttpServletRequest req) {
		if (StringUtil.isNotEmpty(orderInfo.getId())) {
			orderInfo = orderInfoService.getEntity(OrderInfoEntity.class,
					orderInfo.getId());
			req.setAttribute("orderInfoPage", orderInfo);
		}
		return new ModelAndView("material/orderInfo/install/orderInfo-update");
	}
	/**
	 * 加载明细列表[xdkj]
	 * 
	 * @return
	 */
	@RequestMapping(params = "orderProductList")
	public ModelAndView orderProductList(OrderInfoEntity orderInfo,
			HttpServletRequest req) {

		// ===================================================================================
		// 获取参数
		Object id0 = orderInfo.getId();
		// ===================================================================================
		// 查询-xdkj
		String hql0 = "from OrderProductEntity where 1 = 1 AND oRDER_ID = ? ";
		try {
			List<OrderProductEntity> orderProductEntityList = systemService
					.findHql(hql0, id0);
			req.setAttribute("orderProductList", orderProductEntityList);
		} catch (Exception e) {
			logger.info(e.getMessage());
		}
		return new ModelAndView("material/orderInfo/orderProductList");
	}
	
	
	/**
	 * 加载产品明细列表[xdkj]
	 * 
	 * @return
	 */
	@RequestMapping(params = "orderProductDetailList")
	public ModelAndView orderProductDetailList(OrderInfoEntity orderInfo,
			HttpServletRequest req) {

		// ===================================================================================
		// 获取参数
		Object id0 = orderInfo.getId();
		// ===================================================================================
		// 查询-xdkj
		String hql0 = "from OrderProductEntity where 1 = 1 AND oRDER_ID = ? ";
		try {
			List<OrderProductEntity> orderProductEntityList = systemService
					.findHql(hql0, id0);
			req.setAttribute("orderProductList", orderProductEntityList);
		} catch (Exception e) {
			logger.info(e.getMessage());
		}
		return new ModelAndView("material/orderInfo/orderProductDetailList");
	}

	/**
	 * 加载测量人员明细列表[xdkj]
	 * 
	 * @return
	 */
	@RequestMapping(params = "getOrderMeasureList")
	public ModelAndView getOrderMeasureList(OrderInfoEntity orderInfo,
			HttpServletRequest req) {

		// ===================================================================================
		// 获取参数
		Object id0 = orderInfo.getId();
		// ===================================================================================
		// 查询-xdkj
		String hql0 = "from OrderMeasureEntity where 1 = 1 AND oRDER_ID = ? ";
		try {
			List<OrderMeasureEntity> orderMeasureEntityList = systemService
					.findHql(hql0, id0);
			req.setAttribute("orderMeasureList", orderMeasureEntityList);
		} catch (Exception e) {
			logger.info(e.getMessage());
		}
		return new ModelAndView("material/orderInfo/measure/orderMeasureList");
	}
	
	
	/**
	 * 加载安装人员明细列表[xdkj]
	 * 
	 * @return
	 */
	@RequestMapping(params = "getOrderInstallList")
	public ModelAndView getOrderInstallList(OrderInfoEntity orderInfo,
			HttpServletRequest req) {

		// ===================================================================================
		// 获取参数
		Object id0 = orderInfo.getId();
		// ===================================================================================
		// 查询-xdkj
		String hql0 = "from OrderInstallEntity where 1 = 1 AND oRDER_ID = ? ";
		try {
			List<OrderInstallEntity> orderMeasureEntityList = systemService
					.findHql(hql0, id0);
			req.setAttribute("orderInstallList", orderMeasureEntityList);
		} catch (Exception e) {
			logger.info(e.getMessage());
		}
		return new ModelAndView("material/orderInfo/install/orderInstallList");
	}
	/**
	 * 跳转到选择人员列表
	 * 
	 * @return
	 */
	@RequestMapping(params = "goSelectUser")
	public ModelAndView goSelectUser(PartTemplateEntity partTemplate,
			HttpServletRequest req) {
		
		return new ModelAndView("material/orderInfo/selectUsers");
	}

	// -----------------------------------------------------------------------------------
	// 以下各函数可以提成共用部件 (Add by Quainty)
	// -----------------------------------------------------------------------------------
	public void responseDatagrid(HttpServletResponse response,
			JSONObject jObject) {
		response.setContentType("application/json");
		response.setHeader("Cache-Control", "no-store");
		try {
			PrintWriter pw = response.getWriter();
			pw.write(jObject.toString());
			pw.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
